package com.example.demo.utils.error;


//包装器异常处理
public class BusinessException extends Exception implements CommonError{
    private CommonError commonError;
    //BusinessException用于构造业务异常
    public BusinessException(CommonError commonError)
    {
        super();
        this.commonError=commonError;
    }
    //自定义errMsg的方式
    public BusinessException(CommonError commonError,String errMsg)
    {
        super();
        this.commonError=commonError;
        this.commonError.setErrMsg(errMsg);
    }


    @Override
    public int getErrcode() {
        return this.commonError.getErrcode();
    }

    @Override
    public String getErrMsg() {
        return this.commonError.getErrMsg();
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
         this.commonError.setErrMsg(errMsg);
         return this;
    }
}
